import Vue from 'vue'
import VueRouter from 'vue-router'
import login from '@/view/login'
import home from "@/view/home";
import dashboard from "@/view/dashboard/console";
import role from '@/view/role'
import menu from '@/view/menu'
import user from '@/view/user'
import review from '@/view/review'
import sample from '@/view/sample'
import community from '@/view/community'
import reviewCase from '@/view/review/case/index'
import targetIndex from '@/view/target/index'
import system from '@/view/setting/index'
import projectTarget from '@/view/community/project_target/index'
import personalStatistics from '@/view/statistics/personal/index'
import communityStatistics from '@/view/statistics/community/index'
Vue.use(VueRouter)

const routes = [
    {
        path: '/',
        redirect: '/login'
    },
    {
        path: '/login',
        component: login
    },
    {
        path: '/home', component: home, name: 'Home', meta: {title: 'Home'},
        redirect: '/dashboard/index',
        children: [
            {path: '/dashboard/index', component: dashboard, name: '主控台', meta: {title: '主控台', type: 'menu'}},
        ]
    },
    {
        path: '/home', component: home, name: '权限管理', meta: {title: '权限管理'},
        redirect: '/role',
        children: [
            {path: '/dashboard/role_list', component: role, name: '权限列表', meta: {title: '权限列表', type: 'menu'}},
            {path: '/dashboard/menu_list', component: menu, name: '菜单列表', meta: {title: '菜单列表', type: 'menu'}},
        ]
    },
    {
        path: '/home', component: home, name: '用户管理', meta: {title: '用户管理'},
        redirect: '/user',
        children: [
            {path: '/dashboard/user_list', component: user, name: '用户列表', meta: {title: '用户列表', type: 'menu'}},
        ]
    },
    {
        path: '/home', component: home, name: '复查管理', meta: {title: '复查管理'},
        redirect: '/review',
        children: [
            {path: '/dashboard/review_list', component: review, name: '复查列表', meta: {title: '复查列表', type: 'menu'}},
            {path: '/sample/index', component: sample, name: '样本点', meta: {title: '样本点', type: 'method'}},
            {path: '/dashboard/review_case', component: reviewCase, name: '复查案件', meta: {title: '复查案件', type: 'menu'}},
        ]
    },
    {
        path: '/home', component: home, name: '社区管理', meta: {title: '社区管理'},
        redirect: '/community',
        children: [
            {path: '/dashboard/community_list', component: community, name: '社区列表', meta: {title: '社区列表', type: 'menu'}},
            {path: '/dashboard/project_target', component: projectTarget, name: '项目指标', meta: {title: '项目指标', type: 'menu'}},
        ]
    },
    {
        path: '/home', component: home, name: '指标管理', meta: {title: '指标管理'},
        redirect: '/user',
        children: [
            {path: '/dashboard/target_index', component: targetIndex, name: '指标解读', meta: {title: '指标解读', type: 'menu'}},
        ]
    },
    {
        path: '/home', component: home, name: '系统管理', meta: {title: '系统管理'},
        redirect: '/user',
        children: [
            {path: '/dashboard/setting', component: system, name: '系统设置', meta: {title: '系统设置', type: 'menu'}},
        ]
    },
    {
        path: '/home', component: home, name: '统计管理', meta: {title: '统计管理'},
        redirect: '/user',
        children: [
            {path: '/dashboard/personal', component: personalStatistics, name: '个人统计', meta: {title: '个人统计', type: 'menu'}},
            {path: '/dashboard/community', component: communityStatistics, name: '社区统计', meta: {title: '社区统计', type: 'menu'}},
        ]
    },
]
const router = new VueRouter({
    routes
})

export default router
